<template>
  <!--视图-->
  <div>

      <input type="checkbox" v-model="hobby" value="抽烟">抽烟<br>
      <input type="checkbox" v-model="hobby" value="喝酒">喝酒<br>
      <input type="checkbox" v-model="hobby" value="烫头">烫头<br>

    你选择的是:{{hobby}}<br>
    <button @click="change">点击切换</button><br>
     <span v-if="flag">你好,vue </span>
     <span v-if="!flag">你好,张三 </span>
  </div>
</template>

<script>
export default {
  name: "LifeView",
  data() {
    return {
      //默认属性
      hobby:[],
      flag:true
    }
  }, methods: {
    change(){
     // this.msg=   this.msg =="你好,张三"?'你好,Vue':'你好,张三';
      this.flag =!this.flag;
    }
  }, created() {//初始化
    console.log("2-created")
  },beforeCreate() {
    console.log("1-beforeCreate")
  },beforeMount() {
    console.log("3-beforeMount")
  }
}
</script>

<style scoped>

</style>